<script type="text/javascript" src="/assets/vendors/bootstrap/js/bootstrap.min.js"></script>
<div class="top-wrap">
    <nav class="navbar navbar-inverse" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                        aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand logo" href="/home/index.html"><img src="/assets/images/logo/logo.jpg"></a>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <#if Session.loginInfo?exists>
                        <li data="home">
                            <a href="/home/index.html" nav="home">我的主页</a>
                        </li>
                    </#if>
                    <#function f1 id>
                        <#if servletPath?default("")?contains('/group/'+id)>
                            <#return 'class="active"'>
                        <#else>
                            <#return ''>
                        </#if>
                    </#function>
                    <li ${f1('2')}>
                        <a href="/group/2/recommend" nav="推荐">推荐</a>
                    </li>
                    <#list Application.groupList as item>
                        <li ${f1(item.id)}>
                            <#if !item.name?contains("推荐")>
                                <a href="/group/${item.id}/${item.name}" nav="${item.name}">${item.name}</a>
                            </#if>
                        </li>
                    </#list>

                </ul>
                <div id="_search_box" class="search-box navbar-left hidden-xs hidden-sm">
                    <form class="navbar-form" method="get" action="/search">
                        <input type="text" class="form-control" name="word" placeholder="搜索...">
                        <button class="search-btn" type="submit"><i class="fa fa-search"></i></button>
                    </form>
                </div>
                <#if Session.loginInfo?exists>
                    <ul class="nav navbar-nav navbar-right sign">
                        <li class="dropdown">
                            <a href="/post/new" class="publish"><i class="fa fa-magic"></i> 写文章</a>
                        </li>
                        <li class="dropdown">
                            <a href="#" class="ava dropdown-toggle" data-toggle="dropdown">
                                <img class="img-circle" src="${Session.loginInfo.avatar}">
                            </a>
                            <ul class="dropdown-menu" role="menu">
                                <li>
                                    <a href="/account/profile" class="ava">
                                        <img class="img-circle" src="${Session.loginInfo.avatar}"/>
                                        <span>${Session.loginInfo.username}</span>
                                    </a>
                                </li>
                                <li class="divider"></li>
<#--                                <li><a href="/admin">后台管理</a></li>-->
                                <li class="divider"></li>

                                <li><a href="/public/logout">退出</a></li>
                            </ul>
                        </li>
                    </ul>
                <#else >
                    <ul class="nav navbar-nav navbar-right sign">
                        <ul class="nav navbar-nav navbar-right sign">
                            <li><a href="/login.html" class="signin">登录</a></li>

                            <li><a href="/register.html" class="signup">注册</a></li>
                        </ul>
                    </ul>
                </#if>
            </div>
        </div>
    </nav>
</div>
<script type="text/javascript">
    seajs.use('header', function (a) {
        // a.init();
    });
</script>